<?php

require("../config.php");

$act_mesaje = $_GET["tip"];
if (isset($_GET["id"]))
 $id_mesaj = $_GET["id"];
else
 $id_mesaj = 0; 

echo '<table border="0" height="350">';
echo '<tr><td height="15" style="background-image:url(\'img/tab6.gif\'); background-repeat:no-repeat;" height="30">';
echo '<a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'primite\', \'0\');" onMouseOver="javascript:animatie_but(\'but_mesaje_primite\', 1,\'buton\')" onMouseOut="javascript:animatie_but(\'but_mesaje_primite\', 0,\'buton\')" onMouseDown="javascript:animatie_but(\'but_mesaje_primite\', 2,\'buton\')"><div id="but_mesaje_primite" class="butoane_1" style="margin-left:3px;float:left">Primite</div></a>';
echo '<a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'trimise\', \'0\');" onMouseOver="javascript:animatie_but(\'but_mesaje_trimise\', 1,\'buton\')" onMouseOut="javascript:animatie_but(\'but_mesaje_trimise\', 0,\'buton\')" onMouseDown="javascript:animatie_but(\'but_mesaje_trimise\', 2,\'buton\')"><div id="but_mesaje_trimise" class="butoane_1" style="margin-left:3px;float:left">Trimise</div></a>';
echo '<a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'compune\', \'0\');" onMouseOver="javascript:animatie_but(\'but_mesaje_scrie\', 1,\'buton\')" onMouseOut="javascript:animatie_but(\'but_mesaje_scrie\', 0,\'buton\')" onMouseDown="javascript:animatie_but(\'but_mesaje_scrie\', 2,\'buton\')"><div id="but_mesaje_scrie" class="butoane_1" style="margin-left:3px;float:left">Compune</div></a>';
echo '</td></tr>';
echo '<tr><td valign="top">';

///////////////////////////////////
//////////////////////Mesaje trimise
/////////////////////////////////////
if(($act_mesaje == "trimise") || ($act_mesaje == "m_sterge_trimise")||($act_mesaje == "trimite" )||($act_mesaje == "m_trimise"))  {

	//////Stergere mesaj trimis
if($act_mesaje == "m_sterge_trimise") {
$rez_mesaje = mysql_fetch_array(mysql_query("SELECT * FROM mesaje WHERE id = '".$id_mesaj."' LIMIT 1"));
if(($rez_mesaje["dest_stg"] == "sters")||(strtoupper($rez_mesaje["exp"]) == strtoupper("Sistem"))) {
mysql_query("DELETE FROM `mesaje` WHERE `id` = '".$id_mesaj."' LIMIT 1");
} else {
mysql_query("UPDATE `mesaje` SET `exp_stg` = 'sters' WHERE id = '".$id_mesaj."' LIMIT 1");
}
$id_mesaj = 0;
}

	//////Stergere mesaje multiple trimise
if($act_mesaje == "m_trimise")
{
$sir_id = explode("@",$id_mesaj);
for($i=1;$i<=$sir_id[0];$i++)
  {
   $rez_mesaje = mysql_fetch_array(mysql_query("SELECT * FROM mesaje WHERE id = '".$sir_id[$i]."' LIMIT 1"));
  if(($rez_mesaje["dest_stg"] == "sters")||(strtoupper($rez_mesaje["exp"]) == strtoupper("Sistem"))) {
	mysql_query("DELETE FROM `mesaje` WHERE `id` = '".$sir_id[$i]."' LIMIT 1");
	} else {
	mysql_query("UPDATE `mesaje` SET `exp_stg` = 'sters' WHERE id = '".$sir_id[$i]."' LIMIT 1");
	}
  }
 $id_mesaj = 0;
}		

	/////Trimite mesaj
if($act_mesaje == "trimite") {
 list($dest, $subiect, $mesaj) = explode("@", $id_mesaj);
 $id = md5(time().$dest);
 $subiect = addentities($subiect);
 $mesaj = addentities($mesaj);
 $dest = addentities($dest);
 mysql_query("INSERT INTO mesaje (id, subiect, mesaj, exp, dest, timp) VALUES ('".$id."', '".$subiect."', '".$mesaj."', '".$user."', '".$dest."', NOW( ))");
$id_mesaj = 0;
}

	//////Arata mesaje trimise
echo '<form action="#" name="mesaje_trimise"><table width="500" cellspacing="0" cellpading="0" id="mesaje">';
echo '<tr height="25" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">';
echo '<td background="img/tab5.gif" width="30" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-left: 1px #000000 solid;"><input type="checkbox" name="check_trimise" value="" onClick="javascript:selectare_multipla_mesaje(\'trimise\');"/></td>';
echo '<td background="img/tab5.gif" width="200" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid;">Subiect</td>';
echo '<td background="img/tab5.gif" width="70" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid;">Destinatar</td>';
echo '<td background="img/tab5.gif" width="180" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;">Data</td></tr>';
$query = mysql_query("SELECT * FROM mesaje WHERE exp = '".$user."' AND exp_stg = 'nesters' ORDER BY `timp` DESC LIMIT ".$id_mesaj.",10");
$k = 0;
while($rez_mesaje = mysql_fetch_array($query))
		{ 
		 $k++; 
		 echo '<tr height="15" >';
		 echo '  <td width="30" background="img/dot.png" style="border-left: 1px #000000 solid;"><input type="checkbox" name="check_trimise" value="'.$rez_mesaje["id"].'" /></a></td>';
		 echo '  <td width="200" background="img/dot.png"><a href="javascript:void(0);" onMouseUp="javascript:returnare_mesaje(\'m_arata_trimis\', \''.$rez_mesaje["id"].'\');" >'.$rez_mesaje["subiect"];
if($rez_mesaje["status"] == "necitit") { echo ' (mesaj necitit)';}
		 $user_id = mysql_fetch_row(mysql_query("SELECT `id` FROM `users` WHERE `user` = '".$rez_mesaje["dest"]."' LIMIT 1"));
		 echo '  </a></td><td width="70" background="img/dot.png"><a href="javascript:void(0)" onMouseUp="javascript:optiuni_utilizator(\''.$user_id[0].'\');" >'.$rez_mesaje["dest"].'</a></td>';
		 echo '<td width="180" style="border-right: 1px #000000 solid;" background="img/dot.png">'.$rez_mesaje["timp"].'</td></tr>'; 
		} 
if ($k==0){
		 echo '<tr height="15" ><td background="img/dot.png" colspan="4" width="500" style="border-right: 1px #000000 solid; border-left: 1px #000000 solid"> <center>Nu aveti nici un mesaj!</center></td></tr>';
		 		}
				
		 echo '<tr height="25" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">';
		 echo '<td background="img/tab5.gif" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-left: 1px #000000 solid; background-repeat: repeat-x" colspan="2" align="right">';
		 if($id_mesaj+10<mysql_num_rows(mysql_query("SELECT * FROM mesaje WHERE exp = '".$user."' AND exp_stg = 'nesters'"))) { $id_mesaj2 = $id_mesaj +10; } else { $id_mesaj2 = $id_mesaj; }
		 if($id_mesaj>=10) {$id_mesaj3 = $id_mesaj -10;} else {$id_mesaj3 = $id_mesaj;}
		 $id_mesaj4 = $id_mesaj + 10;
		 $x = mysql_num_rows(mysql_query("SELECT * FROM mesaje WHERE exp = '".$user."' AND exp_stg = 'nesters'"));
		 echo '<a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'trimise\', \''.$id_mesaj3.'\');" >&lt;</a>&nbsp;'.$id_mesaj.' - '.$id_mesaj4.'&nbsp;['.$x.']&nbsp;<a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'trimise\', \''.$id_mesaj2.'\');" >&gt;</a></center>';	
		 echo '</td>';
		 echo '  <td background="img/tab5.gif" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-right: 1px #000000 solid; background-repeat: repeat-x" colspan="3" align="right">
				   <a href="javascript:void(0)"  onMouseUp="javascript:returnare_mesaje(\'m_trimise\', stergere_multipla_mesaje(\'trimise\'))" onMouseOver="javascript:animatie_but(\'but_mesaje_sterge\', 1,\'buton\')" onMouseOut="javascript:animatie_but(\'but_mesaje_sterge\',0,\'buton\')" onMouseDown="javascript:animatie_but(\'but_mesaje_sterge\',2,\'buton\')"><div id="but_mesaje_sterge" class="butoane_1">Sterge</div></a></td></tr>'; 		
echo '</table></form>';}

///////////////////////////////
/////////////Arata mesaj trimis individual
///////////////////////////////
if($act_mesaje == "m_arata_trimis") {

$rez_mesaje = mysql_fetch_array(mysql_query("SELECT * FROM mesaje WHERE ID = '".$id_mesaj."'"));
echo '	<table width="500" cellspacing="0" background="img/dot.png" cellpading="0">
		  <tr height="20" style="font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td background="img/tab5.gif" width="500" colspan="2" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid; border-left: 1px #000000 solid; border-right: 1px #000000 solid;">Destinatar: '.$rez_mesaje["dest"].'</td></tr>
		  <tr height="20" style="font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td background="img/tab5.gif" width="500" colspan="2" style="border-bottom: 1px #000000 solid; border-left: 1px #000000 solid; border-right: 1px #000000 solid;">Subiect: '.$rez_mesaje["subiect"].'</td></tr>';

echo '		<tr height="15" ><td width="300" colspan="2" style="text-align: justify" style="border-right: 1px #000000 solid; border-left: 1px #000000 solid"><div style="color: #34ff47; padding: 10px; text-indent: 15px; font-size: 12px;">'.$rez_mesaje["mesaj"].'</div></td></tr>';
echo '      <tr height="20" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td background="img/tab5.gif" width="200" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-left: 1px #000000 solid; background-repeat: repeat-x">Data: '.$rez_mesaje["timp"].'</td><td background="img/tab5.gif" width="300" align="right" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-right: 1px #000000 solid; background-repeat: repeat-x"><a href="javascript:void(0)"  onMouseUp="javascript:returnare_mesaje(\'m_sterge_trimise\', \''.$rez_mesaje["id"].'\');" onMouseOver="javascript:animatie_but(\'but_mesaje_sterge\', 1,\'buton\')" onMouseOut="javascript:animatie_but(\'but_mesaje_sterge\',0,\'buton\')" onMouseDown="javascript:animatie_but(\'but_mesaje_sterge\',2,\'buton\')"><div id="but_mesaje_sterge" class="butoane_1">Sterge</div></a></td></tr>';
		
		echo '</table>';}

///////////////////////////////
///////////////Mesaje primite
///////////////////////////////
if(($act_mesaje == "primite")||($act_mesaje == "m_sterge_primite")||($act_mesaje == "m_primite")) {

	//////Stergere mesaj primit
if($act_mesaje == "m_sterge_primite") {
$rez_mesaje = mysql_fetch_array(mysql_query("SELECT * FROM mesaje WHERE id = '".$id_mesaj."' LIMIT 1"));
if(($rez_mesaje["exp_stg"] == "sters")||(strtoupper($rez_mesaje["exp"]) == strtoupper("Sistem"))) {
mysql_query("DELETE FROM `mesaje` WHERE `id` = '".$id_mesaj."' LIMIT 1");
} else {
mysql_query("UPDATE `mesaje` SET `dest_stg` = 'sters' WHERE id = '".$id_mesaj."' LIMIT 1");
}
$id_mesaj = 0;
}	

	//////Sterere mesaje multiple primite
if($act_mesaje == "m_primite")
{
$sir_id = explode("@",$id_mesaj);
for($i=1;$i<=$sir_id[0];$i++)
  {
  $rez_mesaje = mysql_fetch_array(mysql_query("SELECT * FROM mesaje WHERE id = '".$sir_id[$i]."' LIMIT 1"));
  if(($rez_mesaje["exp_stg"] == "sters")||(strtoupper($rez_mesaje["exp"]) == strtoupper("Sistem"))) {
    mysql_query("DELETE FROM `mesaje` WHERE `id` = '".$sir_id[$i]."' LIMIT 1");
    } else {
    mysql_query("UPDATE `mesaje` SET `dest_stg` = 'sters' WHERE id = '".$sir_id[$i]."' LIMIT 1");
    }
  }
   $id_mesaj = 0;
}

	//////Arata mesaje primite
echo '<form action="#" name="mesaje_primite"><table width="500" cellspacing="0" cellpading="0" id="mesaje">';
echo '<tr height="25" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">';
echo '<td background="img/tab5.gif" width="30" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-left: 1px #000000 solid;"><input type="checkbox" name="check_primite" value="" onClick="javascript:selectare_multipla_mesaje(\'primite\');" /></td>';
echo '<td background="img/tab5.gif" width="200" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid;">Subiect</td>';
echo '<td background="img/tab5.gif" width="70" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid;">Expeditor</td>';
echo '<td background="img/tab5.gif" width="180" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;">Data</td></tr>';
$query = mysql_query("SELECT * FROM mesaje WHERE dest = '".$user."' AND dest_stg = 'nesters' ORDER BY `timp` DESC LIMIT ".$id_mesaj.",10");
$k = 0;
while($rez_mesaje = mysql_fetch_array($query))
		{ 
		 $k++; 
		 echo '<tr height="15">';
		 echo '  <td background="img/dot.png" width="30"style="border-left: 1px #000000 solid;"><input type="checkbox" name="check_primite" value="'.$rez_mesaje["id"].'" /></a></td>';
		 echo '  <td background="img/dot.png" width="200"><a href="javascript:void(0);" onMouseUp="javascript:returnare_mesaje(\'m_arata_primit\', \''.$rez_mesaje["id"].'\');" >'.$rez_mesaje["subiect"];
if($rez_mesaje["status"] == "necitit") { echo ' (nou)';}
		$user_id = mysql_fetch_row(mysql_query("SELECT `id` FROM `users` WHERE `user` = '".$rez_mesaje["exp"]."' LIMIT 1"));
		 echo '  </a></td><td background="img/dot.png" width="70"><a href="javascript:void(0)" onMouseUp="javascript:optiuni_utilizator(\''.$user_id[0].'\');" >'.$rez_mesaje["exp"].'</a>';
		 echo '<td background="img/dot.png" width="180" style="border-right: 1px #000000 solid;">'.$rez_mesaje["timp"].'</td></tr>'; 
		} 
if ($k==0){
		 echo '<tr height="15" ><td background="img/dot.png" colspan="4" width="500" style="border-right: 1px #000000 solid; border-left: 1px #000000 solid"> <center>Nu aveti nici un mesaj!</center></td></tr>';
		 		}
				
		 echo '<tr height="25" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">';
		 echo '<td background="img/tab5.gif" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-left: 1px #000000 solid; background-repeat: repeat-x" colspan="2" align="right">';
		 if($id_mesaj+10<mysql_num_rows(mysql_query("SELECT * FROM mesaje WHERE dest = '".$user."' AND dest_stg = 'nesters'"))) { $id_mesaj2 = $id_mesaj +10; } else { $id_mesaj2 = $id_mesaj; }
		 if($id_mesaj>=10) {$id_mesaj3 = $id_mesaj -10;} else {$id_mesaj3 = $id_mesaj;}
		 $id_mesaj4 = $id_mesaj + 10;
		 $x = mysql_num_rows(mysql_query("SELECT * FROM mesaje WHERE dest = '".$user."' AND dest_stg = 'nesters'"));
		 echo '<a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'primite\', \''.$id_mesaj3.'\');" >&lt;</a>&nbsp;'.$id_mesaj.' - '.$id_mesaj4.'&nbsp;['.$x.']&nbsp;<a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'primite\', \''.$id_mesaj2.'\');" >&gt;</a></center>';	
		 echo '</td>';
		 echo '  <td background="img/tab5.gif" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-right: 1px #000000 solid; background-repeat: repeat-x" colspan="2" align="right">
		 		   <a href="javascript:void(0)"  onMouseUp="javascript:returnare_mesaje(\'m_primite\', stergere_multipla_mesaje(\'primite\'))" onMouseOver="javascript:animatie_but(\'but_mesaje_sterge\', 1,\'buton\')" onMouseOut="javascript:animatie_but(\'but_mesaje_sterge\', 0,\'buton\')" onMouseDown="javascript:animatie_but(\'but_mesaje_sterge\', 2,\'buton\')"><div id="but_mesaje_sterge" class="butoane_1" style="width: 90px; height: 24px;">Sterge</div></a></td></tr>'; 		
echo '</table></form>';}
		
///////////////////////////////////////
////////Arata mesaj primit individual	
///////////////////////////////////////	
if($act_mesaje == "m_arata_primit") {

$rez_mesaje = mysql_fetch_array(mysql_query("SELECT * FROM mesaje WHERE ID = '".$id_mesaj."'"));
echo '	<table width="500" cellspacing="0" background="img/dot.png" cellpading="0">
		  <tr height="20" style="font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td background="img/tab5.gif" width="500" colspan="2" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid; border-left: 1px #000000 solid; border-right: 1px #000000 solid;">Expeditor: '.$rez_mesaje["exp"].'</td></tr>
		  <tr height="20" style="font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td background="img/tab5.gif" width="500" colspan="2" style="border-bottom: 1px #000000 solid; border-left: 1px #000000 solid; border-right: 1px #000000 solid;">Subiect: '.$rez_mesaje["subiect"].'</td></tr>';

echo '		<tr height="15" ><td width="300" colspan="2" style="text-align: justify" style="border-right: 1px #000000 solid; border-left: 1px #000000 solid;"><div style="color: #34ff47; padding: 10px; text-indent: 15px; font-size: 12px;">'.$rez_mesaje["mesaj"].'</div></td></tr>';
echo '      <tr height="20" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td height="30" width="200" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-left: 1px #000000 solid;background-image:url(\'img/tab5.gif\'); background-repeat: repeat-x">
			  Data: '.$rez_mesaje["timp"].'
			</td>
			<td width="300" align="right" style="border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; border-left: 1px #000000 solid; background-image:url(\'img/tab5.gif\'); background-repeat: repeat-x">';
if(strtoupper($rez_mesaje["exp"])!=strtoupper("Sistem")) echo '<a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'compune2\', \''.$rez_mesaje["exp"].'\');" onMouseOver="javascript:animatie_but(\'but_mesaje_compune\', 1,\'buton_mare\')" onMouseOut="javascript:animatie_but(\'but_mesaje_compune\', 0,\'buton_mare\')" onMouseDown="javascript:animatie_but(\'but_mesaje_compune\', 2,\'buton_mare\')"><div id="but_mesaje_compune" class="butoane_2" style="margin-left:3px; float:left">Raspunde la mesaj</div></a>';
echo '		  <a href="javascript:void(0)" onMouseUp="javascript:returnare_mesaje(\'m_sterge_primite\', \''.$rez_mesaje["id"].'\');" onMouseOver="javascript:animatie_but(\'but_mesaje_sterge\', 1,\'buton\')" onMouseOut="javascript:animatie_but(\'but_mesaje_sterge\',0,\'buton\')" onMouseDown="javascript:animatie_but(\'but_mesaje_sterge\',2,\'buton\')"><div id="but_mesaje_sterge" class="butoane_1" style="margin-left:3px; float:right">Sterge</div></a>
			</td></tr>';
		echo '</table>';
mysql_query("UPDATE `mesaje` SET `status` = 'citit' WHERE `id` = '".$id_mesaj."' LIMIT 1");}

//////////////////////////////////////
///////////Compune mesaje
//////////////////////////////////////
if($act_mesaje == "compune") {

echo '
<form id="compune_mesaj" name="compune_mesaj" method="post" action="#" onsubmit="javascript:return false;">
    <table width="500" cellspacing="0" background="img/dot.png" cellpading="0">
		  <tr height="20" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td background="img/tab5.gif" width="100" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid; border-left: 1px #000000 solid;">&nbsp;&nbsp;&nbsp;&nbsp;Destinatar: </td><td width="400" background="img/tab5.gif" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid;  border-right: 1px #000000 solid;"><input type="text" name="destinatar" id="destinatar" onBlur="javascript:trateaza_mesaj()" /></td></tr>
		  <tr height="20" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td background="img/tab5.gif" width="100" style="border-bottom: 1px #000000 solid; border-left: 1px #000000 solid;">&nbsp;&nbsp;&nbsp;&nbsp;Subiect: </td><td width="400" background="img/tab5.gif" style="border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;"><input type="text" name="subiect" id="subiect" /></td></tr>';

echo '		<tr height="15" ><td width="300" colspan="2" style="text-align: justify" style="border-right: 1px #000000 solid; border-left: 1px #000000 solid; color: #34ff47"><center><textarea name="mesaj" cols="55" rows="10"></textarea></center></td></tr>';
echo '      <tr height="20" style="font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td width="100" background="img/tab5.gif" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid; border-left: 1px #000000 solid">&nbsp;</td><td width="400" align="right" background="img/tab5.gif" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid; border-right: 1px #000000 solid;"><input type="button" name="Submit" value=" Trimite " onclick="javascript:trimite_mesaj()" /></td></tr>';
		
		echo '</table></form>';}

if($act_mesaje == "compune2") {

echo '
<form id="compune_mesaj" name="compune_mesaj" method="post" action="#" onsubmit="javascript:return false;">
    <table width="500" cellspacing="0" background="img/dot.png" cellpading="0">
		  <tr height="20" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td background="img/tab5.gif" width="100" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid; border-left: 1px #000000 solid;">&nbsp;&nbsp;&nbsp;&nbsp;Destinatar: </td><td width="400" background="img/tab5.gif" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid;  border-right: 1px #000000 solid;"><input type="hidden" name="destinatar" id="destinatar" value="'.$id_mesaj.'"/>'.$id_mesaj.'</td></tr>
		  <tr height="20" style="border: 1px #FFFFFF solid; font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td background="img/tab5.gif" width="100" style="border-bottom: 1px #000000 solid; border-left: 1px #000000 solid;">&nbsp;&nbsp;&nbsp;&nbsp;Subiect: </td><td width="400" background="img/tab5.gif" style="border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;"><input type="text" name="subiect" id="subiect" /></td></tr>';

echo '		<tr height="15" ><td width="300" colspan="2" style="text-align: justify" style="border-right: 1px #000000 solid; border-left: 1px #000000 solid; color: #34ff47"><center><textarea name="mesaj" cols="55" rows="10"></textarea></center></td></tr>';
echo '      <tr height="20" style="font-family: verdana; font-size: 12; font-weight: bolder; color: #FFFFFF">
		    <td width="100" background="img/tab5.gif" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid; border-left: 1px #000000 solid">&nbsp;</td><td width="400" align="right" background="img/tab5.gif" style="border-bottom: 1px #000000 solid; border-top: 1px #000000 solid; border-right: 1px #000000 solid;"><input type="button" name="Submit" value=" Trimite " onclick="javascript:trimite_mesaj()" /></td></tr>';
		
		echo '</table></form>';}		
?>